<%
'Remember to include [iniDb.inc] file else this Common.asp will throw error for the GetJobCatName function

Dim ShortMonth(13)
ShortMonth(0) = ""
ShortMonth(1) = "Jan"
ShortMonth(2) = "Feb"
ShortMonth(3) = "Mar"
ShortMonth(4) = "Apr"
ShortMonth(5) = "May"
ShortMonth(6) = "Jun"
ShortMonth(7) = "Jul"
ShortMonth(8) = "Aug"
ShortMonth(9) = "Sep"
ShortMonth(10) = "Oct"
ShortMonth(11) = "Nov"
ShortMonth(12) = "Dec"

Function FormatDate(DateObj)
    FormatDate = Day(DateObj) & " " & ShortMonth(Month(DateObj)) & " " & Year(DateObj)
End Function

Function GetJobCatName(CatCode)
    Dim cmd, SqlParam, rs
    SqlConn.Open
    Set cmd = Server.CreateObject("ADODB.Command")
    cmd.CommandText = "SELECT CAT_DESC FROM JOB_ADVERT_CATEGORY WHERE CAT_CODE=?"
    cmd.ActiveConnection = SqlConn
    set SqlParam = cmd.CreateParameter(, 129, , 4, CatCode)
    cmd.Parameters.Append SqlParam
    Set rs = Server.CreateObject("ADODB.RecordSet")
    rs.Open cmd, , 3
    If rs.RecordCount > 0 Then
        GetJobCatName = rs("CAT_DESC")
    Else
        GetJobCatName = ""
    End If
    SqlConn.Close
End Function

Function getValue(obj)
    If obj is Nothing Then
        getValue = "-"
    Elseif obj = "" Then
        getValue = "-"
    Else
        getValue = cstr(obj)
    End If
End Function

%>